//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	RuleConditionExts.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

namespace Smart.Common.Rules
{
	/// <summary>
	/// Rule's condition extension methods
	/// </summary>
	public static class RuleConditionExts
	{
		/// <summary>
		/// Checks whether condition is single (contains no child conditions)
		/// </summary>
		/// <param name="condition">Condition to check</param>
		/// <returns>true, if single</returns>
		public static bool IsSingle(this IRuleCondition condition)
		{
			if (condition == null)
				return true;

			return condition.Children == null || condition.Children.Count <= 0;
		}
	}
}